package edu.centenary.matching_game;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Matching_GameActivity extends Activity {
	private Button B1;
	private Button B2;
	
	
    /** Called when the activity is first created. */
   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        B1 = (Button)findViewById(R.id.easy);
        B1.setOnClickListener(new GameClickListener(3));
        B2 = (Button)findViewById(R.id.hard);
        B2.setOnClickListener(new GameClickListener(5));
        
    }

    /**
	 * Builds a Bundle with the size inside, attaches it to an activity
	 * and starts it up.
	 */
	
    private class GameClickListener implements OnClickListener {

    	/** The size of the board */
    	private int size;
    	
    	/**
    	 * Constructs the Listener
    	 * @param size 
    	 */
    	public GameClickListener(int size) {
    		this.size = size;
    	}
    	
    	/**
    	 * Builds a Bundle with the size inside, attaches it to an activity
    	 * and starts it up.
    	 */

		public void onClick(View arg0) {
    		Intent i = new Intent(Matching_GameActivity.this, GameActivity.class);
    		Bundle bundle = new Bundle();
    		bundle.putInt("size", size);
    		i.putExtras(bundle);
    		startActivity(i);			
		}
    }
}